s=input()
k=0
if len(s)<8:
    print(1)
    k=k+1
if not s.isalnum():
    print(2)
    k=k+1
daxie=False
shuzi=False
for i in s:
    if i.isupper():
        daxie=True
    elif i.isdigit():
        shuzi=True
if not (daxie and shuzi):
    print(3)
    k=k+1
if k==0:
    print(0)
    
